/*
** smse2k filesystem interface
** Main program side. Private.
*/

#ifndef _FILESYSTEM_H
#define _FILESYSTEM_H

#define FSYS_INTERFACE_VERSION_1 1

#define FSYS_PERMISSION_READ  1
#define FSYS_PERMISSION_WRITE 2

typedef void* FILE_HANDLE;


// Including windows.h makes the link shit, so we need to make sure that UINT64 compiles correctly (needs to be unsigned long).
#undef UINT64
#define UINT64 unsigned long

class CBaseFileSystem {
	public:

		// Mount() will mount a file as a directory. Only works in derrived classes
		virtual int Mount(const char* path);

		// Other stuff which is self explanatory
		virtual void CloseFile(FILE_HANDLE file); // Close file
		virtual UINT64 GetFileSize(FILE_HANDLE file); // Get size of file
		virtual void Seek(FILE_HANDLE file, UINT32 offset); // Seek to a specific offset in the file
		virtual UINT64 Read(FILE_HANDLE file, UINT8* buf, UINT32 readsize); // Read stuff
		virtual UINT64 Write(FILE_HANDLE file, UINT8* buf, UINT32 writesize); // Write stuff
		virtual FILE_HANDLE OpenFile(const char* fn, UINT32 permission); // Open stuff

};

// Filesystem. Just goes to stdio, will replace this later
extern CBaseFileSystem filesystem;

#endif